DevOps - CI/CD Cheatsheet

General DevOps CI/CD Concepts

Concept Explanation Notes / Command Example
Continuous Integration (CI) Practice of merging all developers’ working copies to a shared main branch multiple times a day. Automated builds and tests are triggered to detect issues early. Focus on automated tests & immediate feedback. Helps avoid “integration hell.”
Continuous Delivery (CD) Ensures code is always in a deployable state by automating release processes. Builds on CI by adding automated deployment pipelines. Aim to push code changes to production-like environments frequently, with minimal manual intervention.
Continuous Deployment Every change that passes all stages of the production pipeline is automatically released to users. Fully automates the release process. Requires high confidence in tests and rollback mechanisms.
Build Pipeline A series of automated steps (build, test, deploy) triggered by code changes. Also called a CI/CD pipeline. Can include code quality checks, security scans, integration tests, etc.
Branching Strategy Describes how teams manage code changes in different branches (e.g., GitFlow, trunk-based development). Choose a strategy that aligns with release cycles and team size.
Artifact Repository Stores build artifacts (e.g., .jar files, Docker images) so they can be consistently accessed by later stages in the pipeline. Examples include Nexus, Artifactory, or built-in container registries in GitHub, GitLab, etc.
Infrastructure as Code (IaC) Managing infrastructure (servers, networks) with code and automation. Tools like Terraform, CloudFormation, etc. Version your infrastructure definition and keep it consistent across environments.
Release Management Planning, scheduling, and controlling the build and deployment of releases to test and live environments. Often includes versioning, staging, approvals, and documentation.

Git

Concept / Command Explanation Example
git init Initialize a new Git repository in a local folder. git init
git clone Copy an existing repository (remote or local) into a new local directory. git clone <repo-url>
git add Stage changes for the next commit. git add . or git add <file>
git commit Record changes in the local repository with a message describing the changes. git commit -m "Commit message"
git push Upload local commits to a remote repository. git push origin <branch>
git pull Fetch changes from the remote and merge into the local branch. git pull origin <branch>
git branch List, create, or delete branches. List: git branch
Create: git branch <new-branch>
Delete: git branch -d <branch>
git checkout Switch between branches or restore files. git checkout <branch>
git merge Merge changes from one branch into another. git merge <branch>
git rebase Rewrite commits from one branch onto another to maintain a linear history. git rebase <branch>
git stash Temporarily store changes in a “stash” so you can switch branches without committing. git stash, git stash pop
git tag Create a tag for a commit, often used for versioning. git tag v1.0.0
git log / git diff View commit history or changes between commits. git log, git diff HEAD~1 HEAD

GitHub

Feature / Concept Explanation Note / Example
Repository Hosted Git repository on GitHub. Use GitHub Issues to track tasks and bugs.
Pull Request (PR) Proposed changes from one branch (or fork) to another. Allows code review before merging. Often triggers CI checks in GitHub Actions.
GitHub Issues Built-in issue tracking system. Used for bugs, enhancements, tasks. Can link issues to pull requests for auto-closing on merge.
GitHub Projects Kanban-style project boards for issue and PR organization. Helps visualize workflows (To Do, In Progress, Done).
GitHub Pages Simple way to host static websites directly from a repo. Used for documentation or demos. Enable in repo settings.
Branch Protection Rules Rules that govern how branches (often main) can be merged, including required reviews, statuses, etc. Ensures code quality by enforcing PR checks.

GitHub Actions

Feature / Concept Explanation Example (workflow snippet)
Workflow A custom automated process made of one or more jobs. Defined in .github/workflows.
  name: CI
  on: [push]
  jobs:
    build:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - name: Build
          run: make build
        
Jobs Set of steps that execute on the same runner. Runs in parallel by default if multiple jobs exist. Define multiple jobs under jobs: with different steps or runners.
Steps Individual tasks within a job. Each step is either a shell command or an action. Examples: run: npm test or - uses: actions/checkout@v2
Triggers (on:) Events that cause the workflow to run (push, pull_request, schedule, etc.). on: pull_request
Actions Reusable units of code that perform a specific task (e.g., setup a language environment). - uses: actions/setup-node@v2
Runner Host machine where your jobs execute. Can be GitHub-hosted or self-hosted. Default runs-on: ubuntu-latest uses GitHub-hosted Linux runner.
Secrets Encrypted environment variables stored in the repository or organization settings. Access in workflows with ${{ secrets.MY_SECRET }}.

GitLab

Feature / Concept Explanation Example / Notes
GitLab CI/CD Built-in CI/CD system that runs pipeline jobs from your repo. Defined in a .gitlab-ci.yml file.
.gitlab-ci.yml Configuration file for GitLab CI/CD pipelines. Defines stages, jobs, and scripts.
  stages:
    - build
    - test
  
  build_job:
    stage: build
    script:
      - make build
  
  test_job:
    stage: test
    script:
      - make test
        
Stages Define the sequence in which jobs run (e.g., build, test, deploy). Jobs in the same stage run in parallel. All jobs in stage build run first, then test, etc.
Jobs Steps within a stage, containing scripts to run, environment settings, etc. You can set only or except to control which branches/triggers run the job.
Runners Agents that run your jobs. Can be shared or specific to a project. Self-managed or GitLab-managed (shared) runners are possible.
Environments Define environment scopes like dev, staging, production. Useful for environment-specific deployments. Allows you to review deployments in a dedicated environment URL.
Artifacts Files and directories created by a job and passed to subsequent jobs. Example: artifacts: paths: [dist/]

Jenkins

Feature / Concept Explanation Example / Notes
Jenkins Pipeline Groovy-based DSL that defines your build pipeline as code in a Jenkinsfile.
  pipeline {
    agent any
    stages {
      stage('Build') {
        steps {
          sh 'make build'
        }
      }
      stage('Test') {
        steps {
          sh 'make test'
        }
      }
    }
  }
        
Freestyle Project Older style of Jenkins project configuration done through the GUI. Less flexible than Pipelines as Code. Still widely used, but migrating to Pipelines is recommended for modern CI/CD.
Declarative Pipeline A simpler, more opinionated syntax for Jenkins pipelines. Uses pipeline { ... } syntax. Encourages a standard structure (stages, steps, post actions).
Scripted Pipeline More expressive pipeline definition using Groovy script. Offers more flexibility than declarative pipelines. Powerful but can become complex quickly.
Plugins Jenkins can be extended with a wide variety of plugins (e.g., Git plugin, Docker plugin). Be mindful of plugin version compatibility and security.
Agents (Nodes) Machines (or containers) that Jenkins uses to run tasks. Can be on-prem or in the cloud. Use agent any or specify label constraints in the pipeline.
Credentials Management Store secrets (API keys, passwords) in Jenkins. Access them securely in pipelines. Use the withCredentials or environment variables in your pipeline steps.
Blue Ocean Alternative modern UI for Jenkins to visualize pipelines. Optional plugin offering a more user-friendly pipeline view.

Other Notable Tools / Concepts

Tool / Concept Explanation Usage / Notes
Terraform (IaC) Allows provisioning of infrastructure across multiple cloud providers using a unified language (HCL). terraform init, terraform plan, terraform apply
Docker Containerization platform for packaging and running applications in isolated environments. docker build -t myapp ., docker run myapp
Kubernetes (K8s) Container orchestration system that automates deployment, scaling, and management of containerized apps. kubectl apply -f deployment.yaml
Helm Package manager for Kubernetes, simplifies deployment of complex applications using “charts.” helm install myrelease ./mychart
Argo CD GitOps continuous delivery tool for Kubernetes. Syncs deployments to a cluster from a Git repository automatically.
Jenkins X Jenkins for Kubernetes, incorporating best practices for CI/CD in containerized cloud environments. Focuses on GitOps and automation of pipelines in K8s.
Versioning & Semantic Versioning Scheme to label releases with meaningful version numbers (MAJOR.MINOR.PATCH). Breaking changes increment major, backward-compatible features increment minor, patches increment patch.